#in python all methods are virtual!

class MyException(Exception):
      def __init__(self, message):
        print "MyExceptions"
        self.message = message
      def __str__(self):
        return repr(self.message)

class MySocketException(MyException):
     pass

class MyOtherException(MyException):
      def __init__(self, message):
        print "MyOtherException"
        self.message = message
      def __str__(self):
        return repr(self.message)

def f():
    raise MyOtherException("Moj wyjatek: Wystapil straszny blad !")

if __name__ == '__main__':
    try:
        f()
    except MyException, e:
        print e
